import Vue from 'vue'
import VueRouter from 'vue-router'

//一级路由
import DashBoard from './../views/dashboard/DashBoard'
//二级路由
import Home from './../views/home/Home'
import Category from './../views/category/Category'
import Cart from './../views/cart/Cart'
import Mine from './../views/mine/Mine'

//引入组件相关父路由
import Order from './../views/order/Order'
//二级路由
import MyAddress from '../views/order/children/MyAddress'
//三级路由
import AddAddress from '../views/order/children/children/AddAddress'
import EditAddress from '../views/order/children/children/EditAddress'

//引入登录组件
import Login from './../views/login/Login'

Vue.use(VueRouter);

export default new VueRouter({
 routes: [
   {
     path: '/',
     redirect: '/dashboard',
   },
   {
     path: '/dashboard',
     name: 'DashBoard',
     component: DashBoard,
    children:[
      {
        path: '/dashboard',
        redirect: '/dashboard/home',
      },
      {
        path: '/dashboard/Home',
        name: 'Home',
        component: Home,
      },
      {
        path: '/dashboard/category',
        name: 'Category',
        component: Category,
      },
      {
        path: '/dashboard/cart',
        name: 'Cart',
        component: Cart,
      },
      {
        path: '/dashboard/mine',
        name: 'Mine',
        component: Mine
      },
    ],
  },
   {
     path: '/confirmOrder',
     name: 'order',
     component: Order,
     children: [
       {
         path: 'myAddress',
         name: 'myAddress',
         component: MyAddress,
         children: [
           //添加地址
           { path: 'addAddress', name: 'addAddress', component: AddAddress},
           //编辑地址
           { path: 'editAddress', name: 'editAddress', component: EditAddress}
         ],
       }
     ]
   },
   {
     path:'/login',
     name: 'login',
     component: Login
   }
]
});
